#ifndef shift_jis_h
#define shift_jis_h

// this header needs
#include "wchar.h"
#include "ascii.h"

// shift_jis is an encoding that maps characters from 1 to 2 bytes
// it maps a lot of japanese characters but I can't read them
// https://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/SHIFTJIS.TXT

// in TLOZ: TWW
// - the 0x5C character shows up like a yen sign
// - the 0xB8 character (currency symbol) does not show up

#define OWL_MIN_SHIFT_JIS 0x0000
#define OWL_MAX_SHIFT_JIS 0xEAA4
#define OWL_INV_SHIFT_JIS 0xFFFF
#define OWL_INV_SHIFT_JIS_STR     "[INV_SHIFT_JIS_INT]"
#define OWL_INV_ENC_SHIFT_JIS_STR "[INV_ENC_SHIFT_JIS]"

// character constants (wchar.h)
owl_wchar OWL_SHIFT_JIS_NUM[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                                 'A', 'B', 'C', 'D', 'E', 'F',
                                 'a', 'b', 'c', 'd', 'e', 'f',
                                 '+', '-', '.', 'X', 'x'};
owl_wchar OWL_SHIFT_JIS_WSP[] = {'\t', '\n', '\v', '\f', '\r', ' '};
owl_wchar OWL_SHIFT_JIS_PATH[] = {'/', '\\', '.'};
owl_wchar OWL_SHIFT_JIS_LETR[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 
                                  'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
                                  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 
                                  'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
#define OWL_SHIFT_JIS_NULL 0x00

// basic functions
#include "shift_jis_bool_table.c" 
// ^ I am implementing the easiest function to check if a character is valid
owl_byte owl_check_wchar_shift_jis(owl_wchar ch);
owl_byte owl_check_wchar_enc_shift_jis(owl_byte * src, owl_umax size);
owl_wchar owl_get_wchar_shift_jis(owl_byte * src, owl_umax size);
owl_byte * owl_write_wchar_enc_shift_jis(owl_wchar ch, owl_byte * dest, owl_umax size);
owl_byte owl_print_wchar_shift_jis(owl_wchar ch);
owl_byte owl_print_wchar_enc_shift_jis(owl_byte * src, owl_umax size);

#include "shift_jis.c"

// conversion to unicode
owl_wchar owl_wchar_shift_jis_as_unicode(owl_wchar shift_jis);
owl_wchar owl_wchar_unicode_as_shift_jis(owl_wchar unicode);

#include "shift_jis_unicode.c"

#endif // shift_jis_h
